package com.ph.demo.io;

import java.io.*;

/**
 * 1.创建源
 * 2.选择流
 * 3.操作
 * 4.释放资源
 */
public class StreamDemo {

    public static void main(String[] args)  {
        //创建源

        File file = new File("C:\\Users\\peng\\Desktop\\1.txt");

        try {
            //选择流
            InputStream is = new FileInputStream(file);
            //操作流 读取
            int data1 = is.read();
            int data2 = is.read();
            int data3 = is.read();

            System.out.println((char)data1);
            System.out.println(data2);
            System.out.println(data3);
            //释放资源
            is.close();

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
